package com.pactera.redisdemo.service.impl;

import com.pactera.redisdemo.entity.User;
import com.pactera.redisdemo.mapper.UserMapper;
import com.pactera.redisdemo.service.UserService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author zhangrui
 * @Date 2019/2/1 9:30
 */
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    @Cacheable(value = "cache", keyGenerator = "keyGenerator")
    public User findUser(Integer id) {
        return userMapper.fineUser();
    }

    @Override
    @Cacheable(value = "fiveMin", keyGenerator = "keyGenerator")
    public List<User> findUserList() {
        return userMapper.findUserList();
    }
}
